package com.bidevalution.support.face;

import com.qtp.core.util.IdsUtil;

public class RandomUtil {
	// 随机生成16位字符串
	public static String getRandomStr(int len) {
		String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
//        Random random;
        StringBuffer sb = new StringBuffer();
//        try {
//            random = SecureRandom.getInstanceStrong();
//        } catch (NoSuchAlgorithmException e) {
//			//sonar会扫描到这有问题，实际上不能按sonar提议的方式改
//            random = new Random();
//        }
		for (int i = 0; i < len; i++) {
			int number = Integer.parseInt(IdsUtil.getRandomNumber(base.length()));
//			int number = random.nextInt(base.length());
			sb.append(base.charAt(number));
		}
		return sb.toString();
	}
}
